package cn.com.bluemoon.daps.common.datascope.log.impl;

import cn.com.bluemoon.daps.common.datascope.log.ILogService;
import cn.com.bluemoon.daps.common.datascope.log.OperateLog;
import cn.com.bluemoon.daps.common.datascope.log.holder.ProcessLogHolder;
import cn.com.bluemoon.daps.common.domain.UserInfoHolder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 返回且清理Holder
 *
 * @author Jarod.Kong
 */
public class DefaultProcessLogServiceImpl implements ILogService {
    @Override
    public String collector(OperateLog operateLog, HttpServletRequest request,
                            HttpServletResponse response,
                            UserInfoHolder.UserInfo userInfo) {
        try {
            return ProcessLogHolder.get().getContent();
        } finally {
            ProcessLogHolder.clear();
        }
    }
}
